package org.wu.framework.lazy.orm.database.jpa.repository.query;

import org.wu.framework.lazy.orm.database.jpa.repository.enums.QueryType;
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;

import java.lang.reflect.Method;

public class DefaultLazyQueryMetadata implements LazyQueryMetadata {

    private final String querySql;
    private final QueryType queryType;
    private final Method method;
    private final LazyParameters lazyParameters;

    private final LazyLambdaStream lazyLambdaStream;

    public DefaultLazyQueryMetadata(String querySql, QueryType queryType, Method method, LazyParameters lazyParameters, LazyLambdaStream lazyLambdaStream) {
        this.querySql = querySql;
        this.queryType = queryType;
        this.method = method;
        this.lazyParameters = lazyParameters;
        this.lazyLambdaStream = lazyLambdaStream;
    }

    /**
     * 用于处理含有注解@select、@insert 的方法
     *
     * @return 返回 LazyLambdaStream 对象
     */
    @Override
    public LazyLambdaStream getLazyLambdaStream() {
        return this.lazyLambdaStream;
    }

    /**
     * 获取执行sql
     */
    @Override
    public String getQuerySql() {
        return this.querySql;
    }

    /**
     * 获取执行类型
     */
    @Override
    public QueryType getQueryType() {
        return this.queryType;
    }

    /**
     * 获取需要执行的参数
     */
    @Override
    public LazyParameters getParameters() {
        return this.lazyParameters;
    }

    /**
     * 获取执行方法
     */
    @Override
    public Method getQueryMethod() {
        return this.method;
    }
}
